<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
            // 实现一个扁平化数组 也就是把多维数组转为一维数组   坚哥的写法:
        function flat(arr) {
            const str = arr.toString()
            console.log(str)
            const arrNew = str.split(',')

            return arrNew.map(item => parseInt(item))
        }
        const arr = [1, 2, 3, [4, 5, [6, 7, [88, 99]]]]
        console.log(flat(arr))

    </script>
</body>

</html>